<?php

/**
 * ClassName:动态行为增加器
 * @auditor LeiJunXiang
 * @time 2024/12/10
 */

namespace app\tool\onlineChat;

use think\facade\Cache;

class DynamicActionEnhancer
{
    const TOOL_DYNAMIC_ACTION_ENHANCER = 'DynamicActionEnhancer';
    ##类型
    //最新点赞数
    const LIKE = "_like";
    //最新评论数
    const COMMENT = "_Comment";
    //最新关注数
    const ATTENTION = "_attention";
    //最新@我的人数
    const AT = "_at";

    /**
     * (true/false)开始增加(类型，用户id)
     */
    public function startAdd($type, $userId)
    {
        $reData = false;
        if ($type && $userId) {
            $redis = Cache::store('redis');
            $reData = $redis->inc($userId . $type);
            if (is_int($reData)) {
                $reData = true;
            }
        }
        return $reData;
    }


}